<template>
<div class='main'>
    <div class='head'>
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{path:'/'}">系统设置</el-breadcrumb-item>
          <el-breadcrumb-item :to="{path:'/'}">用户管理</el-breadcrumb-item>
          <el-breadcrumb-item :to="{path:'/'}">人员信息</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class='content'>
        <div class='title'>人员信息</div>
       <el-form ref="form" :model="form" label-width="80px" style='width:80%;margin:auto;'>
          <el-form-item label="登录账号">
            <el-input v-model="form.roleName"></el-input>
          </el-form-item>
          <el-form-item label="登录密码">
            <el-input v-model="form.roleDesc"></el-input>
          </el-form-item>
          <el-form-item label="角色信息">
            <el-button @click='addRole' type="primary">添加</el-button>
          </el-form-item>
           <el-form-item label="姓名">
            <el-input v-model="form.roleName"></el-input>
          </el-form-item>
          <el-form-item label="联系地址">
            <el-input v-model="form.roleDesc"></el-input>
          </el-form-item>
          <el-form-item label="性别">
              <el-radio v-model="form.sex" label="1">男</el-radio>
                <el-radio v-model="form.sex" label="2">女</el-radio>
          </el-form-item>
           <el-form-item label="联系电话">
            <el-input v-model="form.roleName"></el-input>
          </el-form-item>
          <el-form-item label="身份证号">
            <el-input v-model="form.roleDesc"></el-input>
          </el-form-item>
          <el-form-item label="上传资质">
             <el-upload action="" :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" list-type="picture">
  <el-button size="small" type="primary">点击上传</el-button>
  <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
</el-upload>
          </el-form-item>
          
           <el-form-item>
                <el-button type="primary" @click="onSubmit()">确定</el-button>
                <el-button @click="onCancel()">取消</el-button>
            </el-form-item>
        </el-form>
    </div>
    <el-dialog title="角色信息选择" :visible.sync="dialogFormVisible">
    <el-row style='margin:10px;'>
        <el-col :span="16">
        <el-input v-model="search" placeholder="">
             <el-button slot="append">搜素</el-button>
        </el-input>
        </el-col>
    </el-row>
    <el-table :data="gridData" border>
    <el-table-column type="selection" width="100px"></el-table-column>
    <el-table-column prop="name" label="角色名称"></el-table-column>
    <el-table-column prop="address" label="角色描述"></el-table-column>
  </el-table>
  <div slot="footer" class="dialog-footer">
    <el-button @click="dialogFormVisible = false">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </div>
</el-dialog>
</div>
</template>
<script>
  export default {
    name: 'userInfo',
    data() {
      return {
        form: {
          name: '',
          remark: '',
          identity: [],
          type: [],
          sex: 1
        },
        search: '',
        type: '',
        fileList: [],
        dialogFormVisible: false,
        total: 0,
        gridData: []
      }
    },
   beforeRouteEnter (to, from, next) {
      next(vm =>{
      vm.form = Object.assign({},vm.$route.query.data)
      vm.type = vm.$route.query.typeId
      })
   },   
    methods: {
      onSubmit() {
        console.log(this.form);
      },
      onCancel() {
        this.$router.go(-1)
    },
    addRole() {
        this.dialogFormVisible = true
    },
    handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      },
      submit(){}
    }  
  }
</script>
<style lang="scss">
.main{
padding: 10px 20px;
}
.title{
    font-size: 20px;
    font-weight: 600;
    margin: 10px;
}
</style>